{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d19780a6",
   "metadata": {},
   "source": [
    "### ICC模块\n",
    "\n",
    "当数据存在多人标注的时候，为了保证特征的一致性，需要对特征进行ICC校验，这个模块需要在特征提取之后使用。例如\n",
    "* Comp1-传统组学-传统组学特征提取模块提取的特征。\n",
    "* Comp4-What-What特征提取，提取的深度学习特征。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "67135c50",
   "metadata": {},
   "outputs": [],
   "source": [
    "## 获得视频教程\n",
    "from onekey_algo.custom.Manager import onekey_show\n",
    "onekey_show('ICC')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fa1b6716",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "data1 = pd.read_csv('data/ICC1.csv', header=0)\n",
    "data2 = pd.read_csv('data/ICC2.csv', header=0)\n",
    "\n",
    "data1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90f85eae",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "from onekey_algo.custom.components.comp1 import icc_filter_features\n",
    "\n",
    "sel_features, features_icc = icc_filter_features([data1, data2], with_icc=True, threshold=0.75)\n",
    "print(len(sel_features))\n",
    "print(json.dumps(features_icc, indent=True, ensure_ascii=False))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0f9a8b02",
   "metadata": {},
   "outputs": [],
   "source": [
    "data1[sel_features].to_csv('data1_sel.csv', header=True, index=False)\n",
    "data2[sel_features].to_csv('data2_sel.csv', header=True, index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fc6f0e6a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
